📋 Lab Objectives
What You'll Learn Today
- Master conditional statements (if, elif, else)
- Use logical and comparison operators effectively
- Solve real-world problems with conditions
- Handle complex decision-making scenarios
- Implement mathematical calculations with conditions
- Build practical applications like grade systems
🎯 Lab Tasks
1. Divisibility Check
Check if number is divisible by both 3 and 5
2. Multiple of Five
Determine if number is multiple of 5
3. Greatest of Two
Find larger number with equality handling
4. Greatest of Three
Compare three numbers for maximum
5. Quadratic Roots
Calculate real/imaginary roots
6. Leap Year
Check leap year using calendar rules
7. Next Date
Calculate next calendar date
8. Grade Sheet
Generate student grade reports
💡 Real-World Examples
Example 1: E-commerce Discount System
A shopping cart that applies discounts based on purchase amount:
Example 2: ATM Transaction System
Bank ATM that handles different transaction types:
Example 3: Traffic Light Control System
Smart traffic management system:
📝 Assignment Problems
Assignment 1: Employee Salary Calculator
Problem: Create a salary calculation system for a company:
- Basic salary: ₹30,000 per month
- HRA: 40% of basic if basic > ₹20,000, else 30%
- DA: 20% of basic for all employees
- Special allowance: ₹5,000 if experience > 5 years
- Tax: 10% if total salary > ₹50,000, else 5%
- Calculate and display gross salary, tax, and net salary
Assignment 2: Electricity Bill Calculator
Problem: Calculate electricity bill based on usage:
- First 100 units: ₹3.50 per unit
- 101-200 units: ₹4.50 per unit
- 201-500 units: ₹6.00 per unit
- Above 500 units: ₹7.50 per unit
- Additional fixed charge: ₹50
- Display total bill amount and slab used
Assignment 3: Gym Membership System
Problem: Create a gym membership pricing system:
- Basic: ₹1,000/month (access to gym floor)
- Silver: ₹2,000/month (gym + group classes)
- Gold: ₹3,500/month (all facilities + personal trainer)
- Platinum: ₹5,000/month (all benefits + spa access)
- Discount: 20% off for annual membership
- Student discount: 15% off on any plan
- Calculate final price based on plan type and duration
Assignment 4: Hotel Booking System
Problem: Create a hotel room booking system:
- Standard room: ₹2,000/night
- Deluxe room: ₹3,500/night
- Suite: ₹6,000/night
- Seasonal rates: +30% during peak season (Dec-Jan)
- Weekend rates: +20% on Friday-Saturday
- Long stay discount: 15% off for 7+ nights
- Calculate total cost based on room type, dates, and duration
Assignment 5: Insurance Premium Calculator
Problem: Calculate insurance premium based on risk factors:
- Base premium: ₹5,000
- Age factor: +20% if age > 50, +10% if age 40-50
- Health condition: +50% if pre-existing conditions
- Smoking: +30% for smokers
- Occupation: +15% for high-risk jobs
- No-claim bonus: -20% for claim-free history
- Calculate final premium amount
🎯 Practice Challenges
Challenge 1: Smart Home Automation
Create a home automation system that controls devices based on:
- Time of day (morning, afternoon, evening, night)
- Temperature (hot, normal, cold)
- Occupancy (home, away)
- Security level (low, medium, high)
- Control lights, AC, security system, and curtains
Challenge 2: Game Character Level System
Design a character progression system with:
- Experience points and level calculation
- Skill unlocks based on level
- Equipment requirements and restrictions
- Special abilities activation
- Difficulty scaling based on player level